#ifndef NOSAL_LOG_LOGGING_H
#define NOSAL_LOG_LOGGING_H

#include "nosal/log/logger.h"
#include "nosal/log/log_stream.h"

namespace netaos {
namespace nosal {
namespace log {

/**
 * @brief Initialize the logging framework.
 *
 * Inits the logging framework for the application with given properties.
 * In case that in @c logMode the @c kFile flag is set, the directory path needs to be provided.
 * This directory must be writable from the corresponding process UID. The actual file name will be
 * generated by the logging framework.
 *
 * @note The call to @c InitLogging shall be done as early as possible inside the program runnable
 * (normally the @c main() function).
 *
 * @note The behavior of the LogMode flags is not fully supported in current status of implementation.
 * It is not possible to select _console only_ mode. Having a single _kConsole_ flag selected, always
 * will enable also _remote_ mode in addition. Having _file only_ mode however is possible.
 *
 * @code
 * int main(int argc, char* argv[])
 * {
 *   InitLogging("ABCD", "This is the application known as ABCD", LogLevel::kVerbose, LogMode::kSlog2);
 * }
 * @endcode
 *
 * @param[in] application_id    The application ID
 * @param[in] description       Some description
 * @param[in] loglevel          The application's default log reporting level
 * @param[in] logmode           The log mode(s) to be used
 * @param[in] directory_path    The directory path for the file log mode
 */
void InitLogging(std::string application_id,
		std::string description,
		LogLevel loglevel,
		LogMode logmode = LogMode::kRemote,
		std::string directory_path = std::string()) noexcept;


/**
 * @brief Creates a Logger instance.
 *
 * Holds the context which is registered in the slogger2 back-end.
 *
 * @code
 * Logger& g_loggerCtx0{CreateLogger("CTX0", "the default context of application ABCD")}
 * @endcode
 *
 * @param[in] context_id          The _up to four-character_ ID
 * @param[in] description         Some description
 * @param[in] default_loglevel    The default log level, set to Warning severity if not explicitly specified.
 * @return                        @c Logger object of type @c Logger&
 */
Logger& CreateLogger(std::string context_id,
	       	std::string description,
		LogLevel default_loglevel = LogLevel::kWarn) noexcept;


}  // namespace log
}  // namespace nosal
}  // namespace netaos

#endif  // NOSAL_LOG_LOGGING_H
